#include "stdafx.h"
#include "TestCuniform.h"
#include "UECuniform.h"
#include "UEEntityOperation.h"


CPPUNIT_TEST_SUITE_REGISTRATION( TestCuniform );


TestCuniform::TestCuniform()
{
}


TestCuniform::~TestCuniform()
{
}

void TestCuniform::testCreate()
{
	double dX;
	double dY;
	double dZ;
	AcGePoint3d Base;
	AcGeVector3d vY;
	AcGeVector3d vZ;

	dX = 100;
	dY = 200;
	dZ = 300;
	Base.set( 100, 0, 100 );
	vY.set( -1, 1, 0 );
	vZ.set( 0, 0, 1 );

	CUECuniform Cuniform( Base, vY, vZ, dX, dY, dZ , CUECuniform::RightTUs );

	AcDb3dSolid* pSolid = NULL;
	
	pSolid = Cuniform.Create();

	Acad::ErrorStatus es = CUEEntityOperation::AddEntityToDwg( pSolid );
	
	if ( es != Acad::eOk )
	{
	    delete pSolid;
	}
	
	pSolid->close();
	
}

void TestCuniform::testErrorCreate()
{
	double dX;
	double dY;
	double dZ;
	AcGePoint3d Base;
	AcGeVector3d vY;
	AcGeVector3d vZ;

	dX = 100;
	dY = 200;
	dZ = 300;
	Base.set( 0, 0, 0 );
	vY.set( 0, 1, 0 );
	vZ.set( 0, 0, 0 );

	CUECuniform Cuniform( Base, vY, vZ, dX, dY, dZ );

	AcDb3dSolid* pSolid = NULL;
	try
	{
	    pSolid = Cuniform.Create();
	}
	catch ( CString& strError )
	{
	    CPPUNIT_NS::Asserter::fail( (LPCTSTR)strError );
	}
	
	Acad::ErrorStatus es = CUEEntityOperation::AddEntityToDwg( pSolid );
	
	if ( es != Acad::eOk )
	{
	    delete pSolid;
	}
	
	pSolid->close();
	
}
